<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="css/app.css" />
		<style>
			.mui-row.mui-fullscreen>[class*="mui-col-"] {
				height: 100%;
			}
			
			.mui-col-xs-3,
			.mui-col-xs-9 {
				overflow-y: auto;
				height: 100%;
			}
			
			.mui-segmented-control .mui-control-item {
				line-height: 50px;
				width: 100%;
			}
			
			.mui-control-content {
				display: none;
			}
			p.mui-ellipsis{width: 120px;}
			.mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
				background-color: #fff;
			}
			
			
			
			.mui-media-object {
				border-radius: 50%;
				width: 50px;
			}
			
			
			
			
			.mui-media-body {
				margin-top: 7px;
				width: 60%;
			}
			
			.mui-table-view .mui-media-object {
				line-height: 50px;
				max-width: 50px;
				height: 50px;
			}
			
			.mui-table-view-cell a {
				position: relative;
			}
			.icon{display: inline-block;width: 150px;}
			
			.follw {
				width: 50px;
				height: 30px;
				border-radius: 5px;
				text-align: center;
				display: inline-block;
				border: 1px solid #007aff;
				line-height: 30px;
				position: absolute;
				right: 20px;
				top: 22px;
				color: #2a90d7;
			}
			
			
			.mui-control-content:first-of-type{display: block;}
			
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">全部分类</h1>
		</header>
		<div class="mui-content mui-row mui-fullscreen">
			<div class="mui-col-xs-3">
				<div id="segmentedControls" class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-vertical">
					
				</div>
			</div>
			
			
			
			<div id="segmentedControlContents" class="mui-col-xs-9">

			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript" src="js/jquery-2.1.4.js"></script>
		
		<script>
			$(function(){
				$('.mui-control-item').eq(0).addClass('mui-active');
				//调取json数据
				$.ajax({
					type:"get",
					url:"topic.json",
					dataType:"json",
					success: function(data){
        	
                	var html='';
                	var result='';
                	$.each(data,function(a,b){
                		html+='<a class="mui-control-item"  href="#">'+a+'</a>';
                		//console.log(b)
                		
                		
                		result+='<div  class="mui-control-content">';
                		result+='<ul class="mui-table-view">';
              
	                		$.each(b,function(c,d){
	                		//alert(c);
	              			result+='<li class="mui-table-view-cell mui-media">';
	             			result+='<img class="mui-media-object mui-pull-left" src="'+d.logo+'">';
	              			result+='<div class="mui-media-body">';
	             			result+='<span class="icon mui-ellipsis">'+d.title+'</span>';
	              			result+='<p class="mui-ellipsis">'+d.summary+'</p>';
	              			result+='<span class="follw">关注</span></div></a></li>'              			
	                		})
                		result+='</ul>';
                		result+='</div>';
                	})
                	
                	
                	$('#segmentedControls').append(html);
                	$('#segmentedControlContents').append(result);
                   }
				});
				
				
				
				//Tab切换
				$('body').on('click','.mui-control-item',function(){
					var index=$(this).index();
					//alert(index);
					$('.mui-control-content').eq(index).show().siblings('.mui-control-content').hide();
					
				})
				
					
			
				
				
				
			})
		</script>
		
		
	</body>

</html>